using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_PickReturnItemMap : EntityTypeConfiguration<SO_PickReturnItem>
    {
        public SO_PickReturnItemMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Receipt_, t.Receipt_Date, t.Receipt_Quantity, t.Cost_After_Discount, t.Type, t.Category, t.id, t.Status });

            // Properties
            this.Property(t => t.user_invoice_)
                .IsFixedLength()
                .HasMaxLength(20);

            this.Property(t => t.Receipt_)
                .IsRequired()
                .HasMaxLength(7);

            this.Property(t => t.Item)
                .HasMaxLength(10);

            this.Property(t => t.location)
                .HasMaxLength(3);

            this.Property(t => t.BarCode)
                .HasMaxLength(30);

            this.Property(t => t.Description)
                .HasMaxLength(250);

            this.Property(t => t.Default_Vendor_)
                .HasMaxLength(6);

            this.Property(t => t.Default_Vendor)
                .HasMaxLength(50);

            this.Property(t => t.Type)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Category)
                .IsRequired()
                .HasMaxLength(100);

            this.Property(t => t.id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Color)
                .HasMaxLength(30);

            this.Property(t => t.Size)
                .HasMaxLength(30);

            this.Property(t => t.Status)
                .IsRequired()
                .HasMaxLength(13);

            this.Property(t => t.custom1)
                .HasMaxLength(6);

            this.Property(t => t.custom2)
                .HasMaxLength(6);

            this.Property(t => t.MANUFACCODE)
                .HasMaxLength(15);

            // Table & Column Mappings
            this.ToTable("SO_PickReturnItem");
            this.Property(t => t.user_invoice_).HasColumnName("user_invoice#");
            this.Property(t => t.Receipt_).HasColumnName("Receipt#");
            this.Property(t => t.Item).HasColumnName("Item");
            this.Property(t => t.location).HasColumnName("location");
            this.Property(t => t.expirydate).HasColumnName("expirydate");
            this.Property(t => t.Receipt_Date).HasColumnName("Receipt_Date");
            this.Property(t => t.BarCode).HasColumnName("BarCode");
            this.Property(t => t.Description).HasColumnName("Description");
            this.Property(t => t.onhand).HasColumnName("onhand");
            this.Property(t => t.Total_Item_on_hand).HasColumnName("Total_Item_on_hand");
            this.Property(t => t.Receipt_Quantity).HasColumnName("Receipt_Quantity");
            this.Property(t => t.Cost_After_Discount).HasColumnName("Cost_After_Discount");
            this.Property(t => t.Default_Vendor_).HasColumnName("Default_Vendor#");
            this.Property(t => t.Default_Vendor).HasColumnName("Default_Vendor");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.Category).HasColumnName("Category");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.item_Season).HasColumnName("item_Season");
            this.Property(t => t.Color).HasColumnName("Color");
            this.Property(t => t.Size).HasColumnName("Size");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.CURRENCY).HasColumnName("CURRENCY");
            this.Property(t => t.Receipt_season).HasColumnName("Receipt_season");
            this.Property(t => t.CLASS).HasColumnName("CLASS");
            this.Property(t => t.COUNTRY).HasColumnName("COUNTRY");
            this.Property(t => t.BU).HasColumnName("BU");
            this.Property(t => t.vat_enabled).HasColumnName("vat_enabled");
            this.Property(t => t.custom1).HasColumnName("custom1");
            this.Property(t => t.custom2).HasColumnName("custom2");
            this.Property(t => t.ITEMCATEGORY).HasColumnName("ITEMCATEGORY");
            this.Property(t => t.itemtype).HasColumnName("itemtype");
            this.Property(t => t.MANUFACCODE).HasColumnName("MANUFACCODE");
            this.Property(t => t.linetax).HasColumnName("linetax");
        }
    }
}
